package com.lucene.index;

import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.LongField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.document.Field.Store;

/**
 * @author Smile.Wu
 * @date 2016年1月18日  下午2:11:53
 */
public class Position {

	private long pid;
	private String title;
	private long cityId;
	public Position() {
	}
	public long getPid() {
		return pid;
	}
	public void setPid(long pid) {
		this.pid = pid;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public long getCityId() {
		return cityId;
	}
	public void setCityId(long cityId) {
		this.cityId = cityId;
	}
	
	public Document toDocument() {
		Document d = new Document();
		
		Field id = new LongField(PositionField.POSITION_ID, this.pid, Store.YES);
		Field title = new TextField(PositionField.POSITION_TITLE, this.title, Store.YES);
		Field cityId = new LongField(PositionField.CITY_ID, this.cityId, Store.YES);
		
		d.add(id);
		d.add(title);
		d.add(cityId);
		
		return d;
	}
}
